<!-- 样式写下边不起作用，未找到原因 -->
<template>
  <div class="lookInfo-print-container">
    <div
      class="title-name"
      style="font-size: 16px;margin-bottom: 40px;text-align:center;"
    >{{ tableName||'立项前各部门尽调表' }}</div>
    <div class="main-content">
      <table
        border="1px"
        cellspacing="0px"
        cellpadding="10px"
        width="100%"
      >
        <tr>
          <td width="150px">项目名称（代号）</td>
          <td>{{ detailData.info_no || detailData.project_name }}</td>
          <td
            width="110px"
            align="center"
          >签名及时间</td>
        </tr>
        <tr
          v-for="(item, index) in settingList"
          :key="index"
        >
          <td
            width="150px"
            align="center"
          >
            <div style="min-height:120px;width: 150px;display:flex;flex-direction: column;justify-content:center;align-items:center">
              <p>{{ item.name }}</p>
              <p v-if="item.tip">（{{ item.tip }}）</p>
            </div>
          </td>
          <td>
            <div
              v-for="(itm,idx) in item.print_list"
              :key="idx"
              style="width:100%;line-height: 24px;"
            >
              <div v-if="itm.label_type!=='richtext'">{{ itm.label_value }}</div>
              <template v-else>
                <div
                  class="richtext"
                  v-html="itm.label_value"
                />
              </template>
            </div>
          </td>
          <td
            width="120px"
            align="left"
          >
            <template v-if="item.creator">
              <div style="margin-bottom:10px"><span>签名：</span><span style="width: 60px;" /></div>
              <div style="margin-bottom: 5px">{{ item.creator.creator_name }}</div>
              <div>{{ parseTime(item.creator.created_at, "{y}年{m}月{d}日") }}</div>
            </template>
          </td>
        </tr>
        <tr>
          <td
            width="150px"
            align="center"
          >
            <p>总经理意见</p>
          </td>
          <td>
            <template v-if="zjl">
              <div>
                <span v-if="detailData.info_status===4">不予立项</span>
                <span v-else-if="detailData.info_status===5">暂时搁置</span>
                <span v-else-if="detailData.info_status===6||detailData.info_status===10">同意立项</span>
              </div>
              <div v-if="zjl.remark">{{ zjl.remark || '无' }}</div>
            </template>
          </td>
          <td
            width="120px"
            align="left"
          >
            <template v-if="zjl">
              <div style="margin-bottom:10px"><span>签名：</span><span style="width: 60px;" /></div>
              <div style="margin-bottom: 5px">{{ zjl.name }}</div>
              <div>{{ parseTime(zjl.date_time, "{y}年{m}月{d}日") }}</div>
            </template>
          </td>
        </tr>
        <tr>
          <td
            width="150px"
            align="center"
          >
            <p>备注</p>
          </td>
          <td colspan="2">{{ detailData.remark }}</td>
        </tr>
      </table>
    </div>
  </div>
</template>

<script>
import { lookInfoList, generalManagerIdea } from '@/api/projectInformation'
export default {
  props: {
    detailData: {
      type: Object,
      default: () => {}
    },
    settingList: {
      type: Array,
      default: () => {}
    },
    types: {
      type: Number,
      default: 1
    }
  },
  data() {
    return {
      departmentList: [],
      zjl: {},
      tableName: ''
    }
  },
  // 生命周期 - 创建完成（访问当前this实例）
  created() {
    if (this.detailData) {
      generalManagerIdea({ id: this.detailData.resolution_check?.id }).then(
        (res) => {
          if (res.code === 200) {
            console.log(res.data)
            this.tableName = res.data.template_name
            this.zjl = res.data.demand_suggest_people || {}
          }
        }
      )
      if (this.types === 1) {
        this.getLookInfoList({ id: this.detailData.id })
      } else if (this.types === 2) {
        this.getLookInfoList({ id: this.detailData.demand_info_id })
      }
    }
    console.log(this.zjl)
  },
  methods: {
    getLookInfoList(params) {
      lookInfoList(params).then((res) => {
        if (res.code === 200) {
          this.departmentList = res.data
          console.log(res.data)
        }
      })
    }
  }
}
</script>
<style lang="scss">
/* @import url(); 引入css类 */
.lookInfo-print-container {
  .title-name {
    font-size: 16px;
    margin-bottom: 40px;
    text-align: center;
  }
}
</style>
